#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <pthread.h>

void* thr(void* arg) {
    printf("子线程: pid = %d, id = %d\n", getpid(), pthread_self());
}

int main()
{
    
    pthread_t tid;
    int ret = pthread_create(&tid, NULL, thr, NULL);
    if(ret != 0) {
        printf("pthread_create error: %s\n", strerror(ret));
        exit(0);
    }

    if(pthread_equal(pthread_self(), pthread_self()) != 0)   {
        printf("线程相等\n");
    } else {
        printf("线程不相等\n");
    }
    
    sleep(1);

    return 0;
}

